<%--

    Copyright (C) 2008-2009 Cristian Olaru <colaru@gmail.com>
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
            http://www.apache.org/licenses/LICENSE-2.0
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

--%>
<%@ include file="/common/taglibs.jsp"%>

<c:set var="articleTagsLinks">
	<c:if test="${not empty article.tags}">
		<c:forEach var="tag" items="${article.tags}" varStatus ="status">
				<c:if test="${status.index!=0}">, </c:if><a href="<c:url value="/getArticlesByTag.html"/>?tagName=${tag.name}" title="${tag.name}"><c:out value="${tag.name}"/></a>
		</c:forEach>
	</c:if>
</c:set>

<c:set var="articleTags">
	<c:if test="${not empty article.tags}">
		<c:forEach var="tag" items="${article.tags}" varStatus ="status">
				<c:if test="${status.index!=0}">,</c:if><c:out value="${tag.name}" default="java, romania"/>
		</c:forEach>
	</c:if>
</c:set>

<head>
    <title>${article.title}</title>
    <meta name="heading" content="<fmt:bundle basename="ApplicationResources"><fmt:message key='article.content.title'/></fmt:bundle>"/>
	<meta name="description" content="${article.title}. Java Romania, programare Java, carte Java, aplicatii Java, stiri, articole, noutati." />
	<meta name="keywords" content="${article.titleComma}, articole, carti Java, stiri, Java, JEE, JSE, Romania, continut generat de utilizatori, user generated content" />
</head>

<div id="left">
	<h2><img align="top" src="<c:url value="${article.type.urlmin}"/>" title="${article.type.name} "/> ${article.title}</h2>
	<c:set var="nickname" value=""/>
	<authz:authorize ifAnyGranted="ROLE_USER">
		<c:set var="nickname"><authz:authentication operation="username"/></c:set>
	</authz:authorize>
	<p class="subtitle">
	<fmt:bundle basename="ApplicationResources">
		<fmt:message key="article.content.published"> 
			<fmt:param>
				${article.nickname}
				<!--  a href="listArticlesByUser.html?user.id=${article.appUser.id}">${article.nickname}</a-->
			</fmt:param>
			<fmt:param>
				<fmt:formatDate type="both" dateStyle="short" timeStyle="short" value="${article.date}" />
			</fmt:param>
			<fmt:param>
				<a href="getArticlesByCategory.html?categoryName=${article.category.name}">${article.category.name}</a>
			</fmt:param>
		</fmt:message>
	</fmt:bundle>
	</p>

	<!-- Here is the place to the media part of the article -->
	<jsp:include page="${path_theme}/pages/production/includes/mediaPart.jsp"/>

	<!--  
	Real content
	-->

	${article.content}
	<br/>
	<c:if test="${not empty article.source}">
		<fmt:bundle basename="ApplicationResources"><fmt:message key="article.content.source"/></fmt:bundle> <a href="${article.sourceLink}">${article.source}</a>
	</c:if>
	
	<div id="noContent" style="clear: left">
	<hr style="width: 100%; height: 2px; margin-top: 5px; margin-bottom: 5px;" />
	
	<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share/Save/Bookmark"/></a><script type="text/javascript">a2a_linkname=document.title;a2a_linkurl=location.href;</script><script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>	

	<p class="more" ><fmt:bundle basename="ApplicationResources"><fmt:message key="article.content.views"/></fmt:bundle> [${article.viewsNumber}] </p>

	<a id="voting" name="voting"></a>
	<p class="more"><fmt:bundle basename="ApplicationResources"><fmt:message key="article.content.rate"/></fmt:bundle></p>
	<div id="rating"></div>
	<script type="text/javascript">
		$("#rating").rater("rateThis.html?article=${article.id}");
	</script>
	
	<p class="more"><fmt:bundle basename="ApplicationResources"><fmt:message key="article.content.tags"/></fmt:bundle> [
		${articleTagsLinks}
	] </p>
	

	<a id="comments" name="comments"></a>
	<p class="more" ><fmt:bundle basename="ApplicationResources"><fmt:message key="article.content.comments"/></fmt:bundle> [${article.commentsNumber}] </p>
	<c:forEach var="comment" items="${article.comments}" varStatus="status" >
		<c:if test="${comment.status == 1}">
			<div id="infobox">
				<h3>#<c:out value="${status.index + 1}"/>: ${comment.title} </h3>
				<p class="subtitle"><fmt:bundle basename="ApplicationResources"><fmt:message key="article.content.comment"/></fmt:bundle>${comment.nickname} [<fmt:formatDate type="both" dateStyle="full" timeStyle="short" value="${comment.date}" />]</p>
				${comment.content}
			</div>
		</c:if>
	</c:forEach>
	
	<!-- Here the new comment form is included -->
	<p class="more"><fmt:bundle basename="ApplicationResources"><fmt:message key="article.content.new.comment"/></fmt:bundle></p>
	
	<jsp:include page="${path_theme}/pages/production/includes/commentForm.jsp"/>	
	</div>						
</div>